const { ccclass, property } = cc._decorator;

@ccclass
export default class loadGame extends cc.Component {
    WorldAtlas: cc.SpriteAtlas = null;
    SceneryBg: cc.SpriteAtlas = null;
    SceneryFly: cc.SpriteAtlas = null;
    SkillBtPrefab: cc.Prefab = null;
    pickupPrefab: cc.Prefab = null;
    SkillGunPrefab: cc.Prefab = null;
    SkillBtBg: cc.SpriteAtlas = null;
    heroPrefab: cc.Prefab = null;
    Skill_strong: cc.SpriteAtlas = null;
    Skill_elevate: cc.SpriteAtlas = null;
    flyWayPrefab: cc.Prefab = null;
    placeWayPrefab: cc.Prefab = null;
    runWayPrefab: cc.Prefab = null;
    wallWayPrefab: cc.Prefab = null;
    MonsterPrefab: Map<string, cc.Prefab> = null;
    ParticlePrefab: Map<string, cc.Prefab> = null;
    MonsterAtlas: Map<string, cc.SpriteAtlas> = null;
    propsPrefab: Map<string, cc.Prefab> = null;
    statusPrefabs: Map<string, cc.Prefab> = null;
    refreshPrefabs: Map<string, cc.Prefab> = null;
    speedUpAtlas: cc.SpriteAtlas = null;

    worldParam: any = null;
    MonsterJson: any = null;
    RandomJson: any = null;

    onLoad() {
        cc.game.addPersistRootNode(this.node);
    }

    onDestroy() {
        this.flyWayPrefab.decRef();
        this.flyWayPrefab = null;
        this.runWayPrefab.decRef();
        this.runWayPrefab = null;
        this.wallWayPrefab.decRef();
        this.wallWayPrefab = null;
        this.WorldAtlas.decRef();
        this.WorldAtlas = null;
        this.SkillBtPrefab.decRef();
        this.SkillBtPrefab = null;
        this.pickupPrefab.decRef();
        this.pickupPrefab = null;
        this.SkillGunPrefab.decRef();
        this.SkillGunPrefab = null;
        this.SkillBtBg.decRef();
        this.SkillBtBg = null;
        this.SceneryBg.decRef();
        this.SceneryBg = null;
        this.SceneryFly.decRef();
        this.SceneryFly = null;
        this.RandomJson = null;
        this.worldParam = null;
        this.MonsterJson = null;
        this.heroPrefab.decRef();
        this.heroPrefab = null;
        this.speedUpAtlas.decRef();
        this.speedUpAtlas = null;
        this.Skill_strong.decRef();
        this.Skill_strong = null;
        this.Skill_elevate.decRef();
        this.Skill_elevate = null;
        this.statusPrefabs.forEach(element => {
            element.decRef();
            element = null;
        });
        this.statusPrefabs = null;
        this.propsPrefab.forEach((value, key) => {
            value.decRef();
            value = null;
        });
        this.propsPrefab = null;
        this.MonsterPrefab.forEach((value, key) => {
            value.decRef();
            value = null;
        });
        this.MonsterPrefab = null;
        this.ParticlePrefab.forEach((value, key) => {
            value.decRef();
            value = null;
        });
        this.ParticlePrefab = null;
        this.MonsterAtlas.forEach((value, key) => {
            value.decRef();
            value = null;
        });
        this.MonsterAtlas = null;
        this.refreshPrefabs.forEach((value, key) => {
            value.decRef();
            value = null;
        });
        this.refreshPrefabs = null;
    }
}
